package longrise.phone.com.bjjt_jyb.compensate;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.longrise.android.FormParameter;
import com.longrise.android.FrameworkManager;
import com.longrise.android.LFView;

import longrise.phone.com.bjjt_jyb.R;


public class ChooseAccidentTypeNewView extends LFView implements View.OnClickListener {
    private Context context = null;
    private View view = null;
    private String appCaseno;
    private LinearLayout hn_btn_back;
    private RelativeLayout rl_choosesingle_new;
    private RelativeLayout rl_choosetwo_new;

    public ChooseAccidentTypeNewView(Context c, String appCaseNo) {
        super(c);
        this.context = c;
        this.appCaseno = appCaseNo;
    }

    @Override
    public void refreshByTime() {

    }

    @Override
    public FormParameter getFormParameter() {
        FormParameter fp = new FormParameter();
        fp.setShowtitle(false);
        return fp;
    }

    @Override
    public void refresh() {

    }

    @Override
    public View getView() {
        return view;
    }

    @Override
    public void init() {
        initView();
        regEvent(true);
    }

    private void initView() {
        view = View.inflate(context, R.layout.chooseaccidenttypenewview, null);
        hn_btn_back = (LinearLayout) view.findViewById(R.id.hn_btn_back);
        rl_choosesingle_new = (RelativeLayout) view.findViewById(R.id.rl_choosesingle_new);
        rl_choosetwo_new = (RelativeLayout) view.findViewById(R.id.rl_choosetwo_new);
        TextView tv_title = (TextView) view.findViewById(R.id.tv_title);
        tv_title.setText("选择事故类型");
    }

    private void regEvent(boolean b) {
        if (null != hn_btn_back) {
            hn_btn_back.setOnClickListener(b ? this : null);
        }
        if (null != rl_choosesingle_new) {
            rl_choosesingle_new.setOnClickListener(b ? this : null);
        }
        if (null != rl_choosetwo_new) {
            rl_choosetwo_new.setOnClickListener(b ? this : null);
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.hn_btn_back:
                closeForm();
                OnDestroy();
                break;
            case R.id.rl_choosesingle_new:
                //进入拍照
                AccidentLoadingPictureView accidentloadingpicturenewviewtwo = new AccidentLoadingPictureView(context, appCaseno,0,2);
                FrameworkManager.getInstance().showNewForm(context, accidentloadingpicturenewviewtwo);
                break;
            case R.id.rl_choosetwo_new:
                //进入拍照
                AccidentLoadingPictureView accidentloadingpicturenewview_two = new AccidentLoadingPictureView(context, appCaseno,0,3);
                FrameworkManager.getInstance().showNewForm(context, accidentloadingpicturenewview_two);
                break;

        }
    }
}
